#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,m,K,N;
int f[2005][2005];
int jc[2005],nyjc[2005];
inline int C(int x,int y)
{
    return jc[x]*nyjc[y]%N*nyjc[x-y]%N;
}
int ksm(int x,int c)
{
    int re=1;
    while(c>0)
    {
        if(c&1)
        {
            re*=x;
            re%=N;
        }
        x*=x;
        x%=N;
        c>>=1;
    }
    return re;
}

signed main()
{
    freopen("sequence.in","r",stdin);
    freopen("sequence.out","w",stdout);
    cin>>n>>m>>K>>N;
    jc[0]=1;
    for(int i=1;i<=2000;i++)
    {
        jc[i]=jc[i-1]*i%N;
    }
    nyjc[2000]=ksm(jc[2000],N-2);
    for(int i=1999;i>=0;i--)
    {
        nyjc[i]=(i+1)*nyjc[i+1]%N;
    }
    //cout<<nyjc[1]<<endl;
    f[1][0]=1;
    for(int i=1;i<=n;i++)
    {
        for(int j=0;j<=n;j++)
        {
            for(int k=0;k<=n;k++)
            {
                if(j+k>n)
                {
                    break;
                }
                f[i+1][j+k]+=C(n-j,k)*f[i][j]%N*ksm(k,k+K)%N;
                f[i+1][j+k]%=N;
            }
        }
    }
    cout<<f[m+1][n]<<endl;
    return 0;
}
